package com.itlong.cloud.property.resource;

import com.itlong.cloud.POJO.DTO.property.DeviceMediaRemoveWallBindDeviceDTO;
import com.itlong.cloud.POJO.DTO.property.DeviceMediaWallSaveDTO;
import com.itlong.cloud.POJO.DTO.property.DeviceMediaWallUpdateDTO;
import com.itlong.cloud.POJO.VO.property.DeviceMediaWallInfoVO;
import com.itlong.cloud.equip.property.IDeviceMediaWallServiceClient;
import com.itlong.cloud.property.service.IDeviceMediaWallService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <desc>
 *    围墙机设备多媒体信息服务暴露接口实现类.
 * </desc>
 *
 * @createDate 2017-10-23
 */
@RestController
public class DeviceMediaWallServiceResource implements IDeviceMediaWallServiceClient{

    @Autowired
    IDeviceMediaWallService iDeviceMediaWallService; //多媒体设备多媒体信息处理接口

    /**
     * <desc>
     *      保存单个围墙机设备多媒体信息
     * </desc>
     *
     * @param deviceMediaWallSaveDTO  保存围墙机设备多媒体信息数据传输对象
     * @return 受影响的行数
     * @author Lix
     * @createDate 2017-10-23
     */
    @Override
    @RequestMapping(path = "property/deviceMediaWall/saveDeviceMediaWallInfo",method = {RequestMethod.POST})
    public Integer saveDeviceMediaWallInfo(@RequestBody DeviceMediaWallSaveDTO deviceMediaWallSaveDTO) throws Exception {
        return iDeviceMediaWallService.saveDeviceMediaInfo(deviceMediaWallSaveDTO);
    }

    /**
     * <desc>
     *     修改单个围墙机设备多媒体信息【根据多媒体Id（mediaId）】
     * </desc>
     *
     * @param deviceMediaWallUpdateDTO 修改围墙机设备多媒体信息数据传输对象
     * @return 受影响的行数
     * @author Lix
     * @createDate 2017-10-23
     */
    @Override
    @RequestMapping(path = "property/deviceMediaWall/update",method = {RequestMethod.POST})
    public Integer updateDeviceMediaInfo(@RequestBody DeviceMediaWallUpdateDTO deviceMediaWallUpdateDTO) throws Exception {
        return iDeviceMediaWallService.updateDeviceMediaInfo(deviceMediaWallUpdateDTO);
    }

    /**
     * <desc>
     * 根据多媒体资源Id获取围墙机多媒体资源及其对应的地址列表.
     * </desc>
     *
     * @param mediaId 多媒体资源ID
     * @return 围墙机多媒体资源及其对应的地址列表
     * @author LewisLouis
     * @createDate 2017-11-21
     */
    @Override
    @RequestMapping(path = "property/deviceMediaWall/getOneMediaInfo",method = {RequestMethod.POST})
    public DeviceMediaWallInfoVO getOneMediaWallInfo(@RequestParam("mediaId")String mediaId) {
        return iDeviceMediaWallService.getOneMediaInfo(mediaId);
    }

    /**
     * <desc>
     * 删除围墙机多媒体资源-与指定设备的关系.
     * </desc>
     *
     * @param deviceMediaRemoveWallBindDeviceDTO 需要删除的围墙机多媒体资源关联的部分设备关系.
     * @return 受影响的行数
     * @author LewisLouis
     * @createDate 2017-11-23
     */
    @Override
    @RequestMapping(path = "property/deviceMediaWall/removeMediaWallRelation",method = {RequestMethod.POST})
    public Integer removeMediaWallRelation(@RequestBody DeviceMediaRemoveWallBindDeviceDTO deviceMediaRemoveWallBindDeviceDTO) {
        return iDeviceMediaWallService.removeMediaWallRelation(deviceMediaRemoveWallBindDeviceDTO);
    }
}
